home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: andy0756@ix.netcom.com (Andy Connors)
- Newsgroups: comp.lang.c++
- Subject: Re: ostream & streambuf inheritance
- Date: 11 Apr 1996 02:12:01 GMT
- Organization: Netcom
- Message-ID: <4khpph$enc@dfw-ixnews8.ix.netcom.com>
- References: <4jobd7$h0e$3@mhafc.production.compuserve.com>
- NNTP-Posting-Host: irv-ca15-21.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-NETCOM-Date: Wed Apr 10 9:12:01 PM CDT 1996
- X-Newsreader: WinVN 0.99.7
-
- In article <4jobd7$h0e$3@mhafc.production.compuserve.com>,
- 100443.2074@CompuServe.COM writes...
- >
- >Hi all,
- >1) Is there a FAQ?
- >2) I am trying to derive from streambuf to create an ostream like
- >class for output to a DOS graphics screen, using the Borland
- >graphics functions. The problem is, my steambuf::overflow
- >overload works fine, but it is not getting called when I flush
- >the stream:
- >class graphstream : public ostream
- >{
- >
- >--
- >Cygnus Instruments Ltd Ultrasonic NDT Equipment
- > 30 Prince of Wales Rd, Dorchester, Dorset DT1 1PW
- > England
- >Tel +44 (0)1305 265533 Fax +44 (0)1305 269960
-
-
- Peter,
-
- This is correct behavior. The streambuf::sync() override is what gets called
- when you flush the stream. overflow() gets called when the stream object tries
- to put a character (given by the argument to overflow()) into the streambuf,
- but is unable to because the streambuf is full. overflow() and sync()
- generally send the characters to their destination (they might both call the
- same function to do this), but overflow() should do the additional task of
- placing the character passed as argument into the streambuf, or sending it to
- the destination as well - otherwise, you will lose this one character.
-
- Andy Connors
-
-